<template>
  <div>
    <h1>day04组件</h1>
    <button @click="btn()">提供自定义事件</button>
    <button @click="removeBtn()">解除绑定</button>
  </div>
</template>

<script>
export default {
    name:"MyDay04",
    data() {
        return {
            userName:"王谦",
            age:18,
            ids:99,
            schoolNum:150,
        }
    },
    methods:{
        // 提供自定义事件
        btn(){
            this.$emit("wq",this.userName);
            this.$emit("zpj",this.age);
            this.$emit("ch",this.ids);
            this.$emit("yxh",this.ids);
            this.$emit("click",this.ids);
            this.$emit("zml",this.schoolNum);
        },
        // 解除绑定自定义事件
        removeBtn(){
            // 解除绑定一种写法单个
            // this.$off("zml");
            // 解除绑定二种写法多个
            // this.$off(["zml","wq"]);
            // 解除绑定三种写法所有
            this.$off();
        }
    }
}
</script>

<style>

</style>